<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>编辑机场editAirportMaintaince</title>
	</head>
	<link rel="stylesheet" href="../css/common.css" />

	<style>
		.newPlan{
			background:#ff7777;
		}
		.btnBox{
			width:100%;
			text-align:center;
			margin-top:20px;
		}
		.addAir{
			width:400px;
			margin-top:55px;
		}
		.addAir p{
		    margin:0 auto;
			color:#959ca2;
			width:330px;
			height:30px;
			margin-top:15px;
			line-height:30px;
			text-align:right;
		}
		
		input,select{
			width:200px;
			height:100%;
			margin-left:10px;
			padding-left:10px;
			font-family:"微软雅黑";
		}
		input[type=radio]{
			position:relative;
			top:5px;
			right:5px;
		}
		select{
			width:214px;
		}
		.cancel{
			margin-left:15px;
			background-color:#afb1b0;
		}
		.addAir .use{
			text-align:left;
			margin-left:85px;
		}
		.val1,.val2,.val3{
			background:#f9f5f5;
		}
	</style>
	<body>
		<div class="addAir">
			<p>机场三字码:<input class='val1' type="text"  /><strong style="color:red;">*</strong></p>
			<p>机场中文名称:<input class='val2' type="text"  /><strong style="color:red;">*</strong></p>
			<p class='cityCode'>城市三字码:<input class='val3' type="text"  /><strong style="color:red;">*</strong></p>
			<p>是否为热点机场:<select class='val4'><option value='0'>非热点</option><option value="1">热点</option></select><strong style="color:#f1f1f1;">*</strong></p>
			<p class='use'>是否启用:&nbsp;<input value='us' type='radio' name='use'/>是<input value='ns' type='radio' name='use'/>否</p>
		</div>
		
		<div class='btnBox'>
			<button class='Dolo_btn sure'>确认</button>
			<button class='Dolo_btn cancel'>取消</button>
		</div>
		
		
	</body>
		<script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>
		<script type="text/javascript" src="../layer-v2.4/layer/layer.js" ></script>
		<!-- 引入my97日期时间控件 -->
		<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>	
		<script type="text/javascript" src="../js/common.js" ></script>
		<script>		
			var airportCode = getHref().airportCode
			$(".val1").prop("readonly","readonly")
			$(".val2").prop("readonly","readonly")
			$(".val3").prop("readonly","readonly")
			$.get("../Airapt/editPage?airportCode="+airportCode+"&temp="+Math.random,function(data){
				data = JSON.parse(data)
				console.log(data)
				$(".val1").val(data.data.airportCode);
				$(".val2").val(data.data.airportCnNm);
				$(".val3").val(data.data.cityCode);				
				$(".val4").val(data.data.airportHot);				
				if(data.data.useable=="us"){
					$("input[value=us]").attr("checked","checked")
				}if(data.data.useable=="ns"){
					$("input[value=ns]").attr("checked","checked")
				}
			})
			
			$(".sure").click(function(){
				var submitMess = {};
				submitMess.airportCode = $(".val1").val();
				submitMess.airportCnNm = $(".val2").val();
				submitMess.cityCode = $(".val3").val();				
				submitMess.airportHot = $(".val4").val();
				submitMess.useable = $("input[name=use]:checked").val()
				layer.msg('修改中...', {icon: 16,shade: 0.01});
				$.ajax({
					type:"post",
					url:"../Airapt/edit?temp="+Math.random(),
					contentType:'application/json;charset=utf-8',
					async:true,
					data:JSON.stringify(submitMess),
					success:function(data){
						data=JSON.parse(data)
						if(data.status=="1001"){
							layer.msg('编辑机场成功', {icon: 1,time:1000},function(){
								var index = parent.layer.getFrameIndex(window.name);//获取弹窗索引
								parent.layer.close(index);//关闭弹窗
							})	
						}if(data.status=="1002"){
							layer.msg("编辑机场失败,"+data.message,{icon: 2,time:2000},function(){
								
							})
						}
					}
						
				});	
			})
		
		//_____________________________________________________________________________新增机场取消
			$(".cancel").click(function(){
				closeWin()
			})	
		
		</script>
		
		
			
</html>
